class UserInfoResponse {
  int? customerId;
  String? nickName;
  String? avatar;
  String? cover;
  String? intro;
  String? uniqueNo;
  int fansNum;
  int followNum;
  int receiveNum;
  String? mobile;
  int realFlag;
  String? realName;
  String? idCard;
  int officialFlag;
  String? officialName;
  List<String>? officialImage;

  UserInfoResponse({
    this.customerId,
    this.nickName,
    this.avatar,
    this.cover,
    this.intro,
    this.uniqueNo,
    this.fansNum = 0,
    this.followNum = 0,
    this.receiveNum = 0,
    this.mobile,
    this.realFlag = 0,
    this.realName,
    this.idCard,
    this.officialFlag = 0,
    this.officialName,
    this.officialImage,
  });

  factory UserInfoResponse.fromJson(Map<String, dynamic> json) =>
      UserInfoResponse(
        customerId: json['customerId'] as int?,
        nickName: json['nickName'] as String?,
        avatar: json['avatar'] as String?,
        cover: json['cover'] as String?,
        intro: json['intro'] as String?,
        uniqueNo: json['uniqueNo'] as String?,
        fansNum: json['fansNum'] as int,
        followNum: json['followNum'] as int,
        receiveNum: json['receiveNum'] as int,
        mobile: json['mobile'] as String?,
        realFlag: int.tryParse((json['realFlag'] as String?) ?? '') ?? 0,
        realName: json['realName'] as String?,
        idCard: json['idCard'] as String?,
        officialFlag: json['officialFlag'] as int,
        officialName: json['officialName'] as String?,
        officialImage:
            (json['officialImage'] as List?)?.map((e) => e as String).toList(),
      );

  Map<String, dynamic> toJson() => {
        'customerId': customerId,
        'nickName': nickName,
        'avatar': avatar,
        'cover': cover,
        'intro': intro,
        'uniqueNo': uniqueNo,
        'fansNum': fansNum,
        'followNum': followNum,
        'receiveNum': receiveNum,
        'mobile': mobile,
        'realFlag': realFlag,
        'realName': realName,
        'idCard': idCard,
        'officialFlag': officialFlag,
        'officialName': officialName,
        'officialImage': officialImage,
      };
}
